Ship data analysis example

Binder IPYNB HTML

This tutorial uses AIS data published by the Danish Maritime Authority. The AIS record sample extracted for this tutorial covers vessel traffic on the 5th July 2017 near Gothenburg.

This tutorial covers:

  1. Trajectory data preprocessing
    • Loading movement data from common geospatial file formats
    • Exploring spatial & non-spatial data distributions
    • Applying filters to extract relevant data
    • Converting GeoDataFrames into Trajectories describing continuous tracks of moving objects
  2. Trajectory analysis
    • Visualizing trajectories and their properties
    • Filtering trajectories by area of interest
    • Splitting continuous tracks into individual trips
    • Exploring trip properties including: origins, destinations, and attributes

Loading sample AIS data

Let's see what the data looks like:

If we look at the data distributions, we can see that there are a lot of records with speed over ground (SOG) values of zero in this dataframe:

Let's get rid of these rows with zero SOG:

Let's see what kind of ships we have in our dataset:

Finally, let's create trajectories:

Plotting trajectories

Let's give the most common ship types distinct colors. The remaining ones will be just grey:

Visualizing trajectory properties

We can also plot individual trajectories to better visualize their properties, such as the changes in NavStatus:

Finding ships passing under Älvsborgsbron bridge

We can find ships passing under the bridge based on trajectory intersections with the bridge area.

Identifying trip origins and destinations

Since AIS records with a speed over ground (SOG) value of zero have been removed from the dataset, we can use the split_by_observation_gap() function to split the continuous observations into individual trips:

Let's plot the resulting trips!

Compared to plotting the original continuous observations, this visualization is much cleaner because there are no artifacts at the border of the area of interest.

Next, let's get the trip origins:

In our data sample, trip origins can be:

Finding ships that depart from Sjöfartsverket (Maritime Administration)

We can identify vessels that start their trip within a given area of interest by intersecting trip starting locations with our area of interest:

Let's see what kind of ships depart from here:

Of course, the same works for arrivals:

Clustering origins

To run this section, you need to have the scikit-learn package installed.

Continue exploring MovingPandas

  1. Bird migration analysis
  2. Ship data analysis
  3. Horse collar data exploration
  4. OSM traces